/*
* created by Administrator on 2018/11/30
* 好的代码像粥一样,是得用时间和精力熬的。
*/
module.exports = async (ctx, next) => {
    var public = ['/login','/register'];
    if(ctx.session.user || public.indexOf(ctx.path) > -1){
        await next();
    }else{
        ctx.body = {
            code: -1111,
            msg: '你没有权限，请登录'
        }
    }
};